package com.wst.system.server.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wst.system.config.exception.GlobalExcetion;
import com.wst.system.security.entity.SysMenuEntity;
import com.wst.system.security.entity.SysRoleEntity;
import com.wst.system.security.entity.SysUserEntity;
import com.wst.system.security.entity.vo.SysUserEntityAddVo;
import com.wst.system.server.entity.vo.PageSearchVo;
import org.springframework.web.bind.annotation.RequestBody;


import java.util.List;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/11 14:47
 * @since JDK 1.8
 */
public interface SysUserService extends IService<SysUserEntity> {

    /**
     * 根据用户名查询实体
     * @Author Sans
     * @CreateTime 2019/9/14 16:30
     * @Param  username 用户名
     * @Return SysUserEntity 用户实体
     */
    SysUserEntity selectUserByName(String username);

    /**
     * 根据手机号查询用户
     * @param phone
     * @return
     */
    SysUserEntity selectUserByPhone(String phone);

    /**
     * 根据邮箱查询用户
     * @param email
     * @return
     */
    SysUserEntity selectUserByEmail(String email);
    /**
     * 根据用户ID查询角色集合
     * @Author Sans
     * @CreateTime 2019/9/18 18:01
     * @Param  userId 用户ID
     * @Return List<SysRoleEntity> 角色名集合
     */
    List<SysRoleEntity> selectSysRoleByUserId(Integer userId);
    /**
     * 根据用户ID查询权限集合
     * @Author Sans
     * @CreateTime 2019/9/18 18:01
     * @Param  userId 用户ID
     * @Return List<SysMenuEntity> 角色名集合
     */
    List<SysMenuEntity> selectSysMenuByUserId(Integer userId);

    /**
     * 分页
     * @param pageNum 页码
     * @param pageSize 条数
     * @return
     */
    IPage<SysUserEntity> page(Integer pageNum,Integer pageSize,PageSearchVo vo);


    SysUserEntity addUser(SysUserEntity user) throws GlobalExcetion;

    SysUserEntity saveOrUpdate(SysUserEntityAddVo vo) throws GlobalExcetion;

    SysUserEntity getSysUserByPhone(String phone);

    SysUserEntity getSysUserByEmail(String email);

    void deleteIds(List<String> ids);

}
